package smsapi;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.junit.Assert;
import org.junit.jupiter.api.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import smsapi.api.UserApi;
import smsapi.model.BalanceResponse;

import java.util.UUID;


@RunWith(SpringRunner.class)
@SpringBootTest(classes = Application.class)
public class ApiBase {

    @Autowired
    private  UserApi userApi;

    /**
     * 获取令牌
     *
     * @throws ApiException
     *          if the Api call fails
     */
    public String getToken() throws ApiException {
        String timestamp = String.valueOf(System.currentTimeMillis());
        String nonce = UUID.randomUUID().toString().replace("-","");
        String token = userApi.getToken(timestamp,nonce).getToken();
        return token;
    }
    @Test
    public void Test()  {

    }
}
